/**
 * @author Jialun Bian
 * @version 1.0
 */
package userInterface;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.Console;



public class MainFrame {
	public MainPanel mainPanel;
	public MainToolBar toolBar;
    public ConsoleFrame consoleFrame;
    public MainFrame() {
        EnvironmentVariables.init();
        assembuler.Assembuler.init();
        ConsoleFrame.init();
    }
    private void createAndShowGUI() {
        //TODO: add the key_binding to each menubutton
        JFrame frame=new JFrame("SimplePCLogo");
        mainPanel=new MainPanel();
        EnvironmentVariables.mainPanel=mainPanel;
        toolBar=new MainToolBar();
        CommandPanel commandPanel=new CommandPanel();
        consoleFrame = new ConsoleFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setResizable(false);
        frame.setLocationRelativeTo(null);
        frame.getContentPane().add(toolBar,BorderLayout.PAGE_START);
        frame.getContentPane().add(mainPanel,BorderLayout.CENTER);
        frame.getContentPane().add(commandPanel,BorderLayout.PAGE_END);
        frame.setJMenuBar(new MainMenuBar());
        frame.pack();
        //Very Important
        frame.setVisible(true);
        consoleFrame.setVisible(true);
    }
    
	public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
            	MainFrame mainFrame=new MainFrame();
                mainFrame.createAndShowGUI();
            }
        });

	}

}
